package com.zhejiangzhengyuan.municipal_common.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.sql.Timestamp;
import java.io.Serializable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 服务API--行为表，提供两种权限比对方式：1、基于权限点；2、基于URL
 * </p>
 *
 * @author linju
 * @since 2019-11-22
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Action对象", description = "服务API--行为表，提供两种权限比对方式：1、基于权限点；2、基于URL")
public class Action extends Model<Action> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增主键")
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;


    @ApiModelProperty(value = "自我关联，存储父级ID")
    private String selfParentId;

    @ApiModelProperty(value = "API行为编码，可作为权限点")
    private String actionCode;

    @ApiModelProperty(value = "API名称")
    private String actionName;

    @ApiModelProperty(value = "API所在模块名称")
    private String moduleName;

    @ApiModelProperty(value = "API请求URL")
    private String patternUrl;

    @ApiModelProperty(value = "API描述")
    private String actionDesc;

    @ApiModelProperty(value = "记录创建时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Timestamp createTime;

    @ApiModelProperty(value = "记录更新时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    //excel工具类时间转译
    @DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒")
    //指明字段名（value） 或 下标 （index） 二者只选一
    //excel导入导出功能  将时间改为Date
    @ExcelProperty(value = "记录更新时间")
    private Timestamp updateTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
